import request from '@/config/axios'

// 指标 VO
export interface IndicatorVO {
  id: number // 指标ID
  code: string // 指标编码
  name: string // 指标名称
  remark: string // 描述
  apiAddress: string // 调用地址
  apiMethod: string // 请求方法
}

// 指标 API
export const IndicatorApi = {
  // 查询指标分页
  getIndicatorPage: async (params: any) => {
    return await request.get({ url: `/multiModel/indicator/page`, params })
  },

  // 查询指标全部
  getIndicatorList: async () => {
    return await request.get({ url: `/multiModel/indicator/list` })
  },

  // 查询指标详情
  getIndicator: async (id: number) => {
    return await request.get({ url: `/multiModel/indicator/get?id=` + id })
  },

  // 新增指标
  createIndicator: async (data: IndicatorVO) => {
    return await request.post({ url: `/multiModel/indicator/create`, data })
  },

  // 修改指标
  updateIndicator: async (data: IndicatorVO) => {
    return await request.put({ url: `/multiModel/indicator/update`, data })
  },

  // 删除指标
  deleteIndicator: async (id: number) => {
    return await request.delete({ url: `/multiModel/indicator/delete?id=` + id })
  },

  // 导出指标 Excel
  exportIndicator: async (params) => {
    return await request.download({ url: `/multiModel/indicator/export-excel`, params })
  },
}
